# -*- coding: utf-8 -*-
#
# File: passagem.py
#
# Copyright (c) 2007 by CTEC
# Generator: ArchGenXML Version 1.5.0
#            http://plone.org/products/archgenxml
#
# GNU General Public License (GPL)
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
# 02110-1301, USA.
#

__author__ = """CTEC <joaojoao@gmail.com>"""
__docformat__ = 'plaintext'

from AccessControl import ClassSecurityInfo
from Products.Archetypes.atapi import *
from Products.ibictn.content.formulario import formulario
from Products.Archetypes.SQLStorage import *
from Products.ibictn.config import *

# additional imports from tagged value 'import'
import DateTime
from Products.ibictn.Widgets import MonetaryWidget
from Products.DataGridField.DataGridField import DataGridField
from Products.DataGridField.DataGridWidget import DataGridWidget

##code-section module-header #fill in your manual code here
##/code-section module-header

schema = Schema((

    StringField(
        name='cpf',
        widget=StringWidget(
            label="CPF",
            description="",
            label_msgid='ibictn_label_cpf',
            description_msgid='ibictn_help_cpf',
            i18n_domain='ibictn',
        )
    ),

    StringField(
        name='banco',
        widget=StringWidget(
            label="Banco",
            description="",
            label_msgid='ibictn_label_banco',
            description_msgid='ibictn_help_banco',
            i18n_domain='ibictn',
        )
    ),

    StringField(
        name='conta',
        widget=StringWidget(
            label="Número da Conta",
            description="",
            label_msgid='ibictn_label_conta',
            description_msgid='ibictn_help_conta',
            i18n_domain='ibictn',
        )
    ),

    StringField(
        name='tipo',
        widget=SelectionWidget(
            label="Tipo",
            description="",
            label_msgid='ibictn_label_tipo',
            description_msgid='ibictn_help_tipo',
            i18n_domain='ibictn',
        ),
        vocabulary=['Servidor Público Federal','Convidado']
    ),

    StringField(
        name='grupo',
        widget=StringWidget(
            label="",
            description="",
            label_msgid='ibictn_label_grupo',
            description_msgid='ibictn_help_grupo',
            i18n_domain='ibictn',
        )
    ),

    TextField(
        name='objetivo',
        widget=TextAreaWidget(
            label="Objetivo",
            description="descreva o objetivo da viagem",
            label_msgid='ibictn_label_objetivo',
            description_msgid='ibictn_help_objetivo',
            i18n_domain='ibictn',
        )
    ),

    StringField(
        name='roteiro',
        widget=StringWidget(
            label="Roteiro",
            description="lista de cidades",
            label_msgid='ibictn_label_roteiro',
            description_msgid='ibictn_help_roteiro',
            i18n_domain='ibictn',
        )
    ),

    FloatField(
        name='valor',
        default="0.00",
        widget=MonetaryWidget(
            label="Valor da passagem",
            description="valor em reais",
            label_msgid='ibictn_label_valor',
            description_msgid='ibictn_help_valor',
            i18n_domain='ibictn',
        )
    ),

    DateTimeField(
        name='saida',
        widget=CalendarWidget(
            label="Saída",
            description="",
            label_msgid='ibictn_label_saida',
            description_msgid='ibictn_help_saida',
            i18n_domain='ibictn',
        )
    ),

    StringField(
        name='cia_saida',
        widget=StringWidget(
            label="Vôo de saída e companhia aérea",
            description="",
            label_msgid='ibictn_label_cia_saida',
            description_msgid='ibictn_help_cia_saida',
            i18n_domain='ibictn',
        )
    ),

    DateTimeField(
        name='retorno',
        widget=CalendarWidget(
            label="Retorno",
            description="",
            label_msgid='ibictn_label_retorno',
            description_msgid='ibictn_help_retorno',
            i18n_domain='ibictn',
        )
    ),

    StringField(
        name='cia_retorno',
        widget=StringWidget(
            label="Vôo de retorno e companhia aérea",
            description="",
            label_msgid='ibictn_label_cia_retorno',
            description_msgid='ibictn_help_cia_retorno',
            i18n_domain='ibictn',
        )
    ),

    StringField(
        name='reserva',
        widget=StringWidget(
            label="Reserva",
            description="",
            label_msgid='ibictn_label_reserva',
            description_msgid='ibictn_help_reserva',
            i18n_domain='ibictn',
        )
    ),

    DataGridField(
        name='diarias',
        widget=DataGridWidget(
            label="Diárias",
            description="tabela de diárias",
            column_names=('Quantidade','Valor','Total'),
            label_msgid='ibictn_label_diarias',
            description_msgid='ibictn_help_diarias',
            i18n_domain='ibictn',
        ),
        columns=('quantidade','valor','total')
    ),

    DataGridField(
        name='adicional',
        widget=DataGridWidget(
            label="Adicional de deslocamento",
            description="tabela de adicionais",
            column_names=('Quantidade','Valor','Total'),
            label_msgid='ibictn_label_adicional',
            description_msgid='ibictn_help_adicional',
            i18n_domain='ibictn',
        ),
        columns=('quantidade','valor','total')
    ),

    FloatField(
        name='subtotal',
        default="0.00",
        widget=MonetaryWidget(
            label="subtotal",
            description="soma das diarias e dos adicionais",
            label_msgid='ibictn_label_subtotal',
            description_msgid='ibictn_help_subtotal',
            i18n_domain='ibictn',
        )
    ),

    FloatField(
        name='alimentacao',
        default="0.00",
        widget=MonetaryWidget(
            label="Desconto vale alimentação",
            description="",
            label_msgid='ibictn_label_alimentacao',
            description_msgid='ibictn_help_alimentacao',
            i18n_domain='ibictn',
        )
    ),

    FloatField(
        name='outros_gastos',
        default="0.00",
        widget=MonetaryWidget(
            label="Outros gastos",
            description="",
            label_msgid='ibictn_label_outros_gastos',
            description_msgid='ibictn_help_outros_gastos',
            i18n_domain='ibictn',
        )
    ),

    FloatField(
        name='valor_total',
        default="0.00",
        widget=MonetaryWidget(
            label="Valor a ser pago",
            description="",
            label_msgid='ibictn_label_valor_total',
            description_msgid='ibictn_help_valor_total',
            i18n_domain='ibictn',
        )
    ),

    StringField(
        name='fr',
        widget=StringWidget(
            label="FR",
            description="Dado Orçamentario - Fonte de Recursos",
            label_msgid='ibictn_label_fr',
            description_msgid='ibictn_help_fr',
            i18n_domain='ibictn',
        ),
        read_permission="ibictn: Ler campo",
        write_permission="ibictn: Escrever campo"
    ),

    StringField(
        name='ptres',
        widget=StringWidget(
            label="PTRES",
            description="Dado Orçamentario - Progama de Trabalho Resumido",
            label_msgid='ibictn_label_ptres',
            description_msgid='ibictn_help_ptres',
            i18n_domain='ibictn',
        ),
        read_permission="ibictn: Ler campo",
        write_permission="ibictn: Escrever campo"
    ),

    StringField(
        name='nd',
        widget=StringWidget(
            label="ND",
            description="Dado Orçamentario - Nota de Dotação",
            label_msgid='ibictn_label_nd',
            description_msgid='ibictn_help_nd',
            i18n_domain='ibictn',
        ),
        read_permission="ibictn: Ler campo",
        write_permission="ibictn: Escrever campo"
    ),

    StringField(
        name='uo',
        widget=StringWidget(
            label="UO",
            description="Dado Orçamentario - Unidade Orçamentária",
            label_msgid='ibictn_label_uo',
            description_msgid='ibictn_help_uo',
            i18n_domain='ibictn',
        ),
        read_permission="ibictn: Ler campo",
        write_permission="ibictn: Escrever campo"
    ),

    StringField(
        name='ne',
        widget=StringWidget(
            label="NE",
            description="Dado Orçamentario - Nota de Empenho",
            label_msgid='ibictn_label_ne',
            description_msgid='ibictn_help_ne',
            i18n_domain='ibictn',
        ),
        read_permission="ibictn: Ler campo",
        write_permission="ibictn: Escrever campo"
    ),

),
)

##code-section after-local-schema #fill in your manual code here
##/code-section after-local-schema

passagem_schema = BaseSchema.copy() + \
    getattr(formulario, 'schema', Schema(())).copy() + \
    schema.copy()

##code-section after-schema #fill in your manual code here
##/code-section after-schema

class passagem(formulario, BaseContent):
    """
    """
    security = ClassSecurityInfo()
    __implements__ = (getattr(formulario,'__implements__',()),) + (getattr(BaseContent,'__implements__',()),)

    # This name appears in the 'add' box
    archetype_name = 'Solicitação de Passagens'

    meta_type = 'passagem'
    portal_type = 'passagem'
    allowed_content_types = [] + list(getattr(formulario, 'allowed_content_types', []))
    filter_content_types = 0
    global_allow = 1
    #content_icon = 'passagem.gif'
    immediate_view = 'base_view'
    default_view = 'base_view'
    suppl_views = ()
    typeDescription = "Solicitação de diárias e passagens"
    typeDescMsgId = 'description_edit_passagem'
    allow_discussion = 1

    _at_rename_after_creation = True

    schema = passagem_schema

    ##code-section class-header #fill in your manual code here
    ##/code-section class-header

    # Methods


registerType(passagem, PROJECTNAME)
# end of class passagem

##code-section module-footer #fill in your manual code here
##/code-section module-footer



